Make magic comparisons work correctly in the cache.
authorMatthias Clasen <mclasen@redhat.com>
Tue, 18 Oct 2005 20:32:35 +0000 (20:32 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 18 Oct 2005 20:32:35 +0000 (20:32 +0000)
2005-10-18  Matthias Clasen  <mclasen@redhat.com>

        * xdgmimecache.c: Make magic comparisons work correctly
        in the cache.

gtk/xdgmime/ChangeLog
gtk/xdgmime/xdgmimecache.c

index 3c5223a4e65705f04cfdc83f9f6eaebb5adc17c3..5b18a59b903d1f22d555bf969f134b5ebfc724e6 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-18  Matthias Clasen  <mclasen@redhat.com>
+
+       * xdgmimecache.c: Make magic comparisons work correctly
+       in the cache.
+
 2005-10-17  Matthias Clasen  <mclasen@redhat.com>
 
        * xdgmime.c (xdg_mime_get_mime_type_for_file): Remove
index 002b0f20d7092e00ec8d3d2a34c5876eb03a9154..e37abb162b06dcf499b2323e81652dd8b648fef5 100644 (file)
@@ -176,8 +176,8 @@ cache_magic_matchlet_compare_to_data (XdgMimeCache *cache,
        {
          for (j = 0; j < data_length; j++)
            {
-             if ((cache->buffer[data_offset + j] & cache->buffer[mask_offset + j]) !=
-                 ((((unsigned char *) data)[j + i]) & cache->buffer[mask_offset + j]))
+             if ((((unsigned char *)cache->buffer)[data_offset + j] & ((unsigned char *)cache->buffer)[mask_offset + j]) !=
+                 ((((unsigned char *) data)[j + i]) & ((unsigned char *)cache->buffer)[mask_offset + j]))
                {
                  valid_matchlet = FALSE;
                  break;
@@ -188,7 +188,7 @@ cache_magic_matchlet_compare_to_data (XdgMimeCache *cache,
        {
          for (j = 0; j < data_length; j++)
            {
-             if (cache->buffer[data_offset + j] != ((unsigned char *) data)[j + i])
+             if (((unsigned char *)cache->buffer)[data_offset + j] != ((unsigned char *) data)[j + i])
                {
                  valid_matchlet = FALSE;
                  break;
@@ -296,7 +296,7 @@ cache_alias_lookup (const char *alias)
   for (i = 0; _caches[i]; i++)
     {
       XdgMimeCache *cache = _caches[i];
-      xdg_uint32_t list_offset = GET_UINT32 (cache->buffer, 4 );
+      xdg_uint32_t list_offset = GET_UINT32 (cache->buffer, 4);
       xdg_uint32_t n_entries = GET_UINT32 (cache->buffer, list_offset);
       xdg_uint32_t offset;